
<template>
    <div class="header">
        <el-header>
            <div class="title">商家管理系统</div>
            <div class="opt-wrapper">
                <el-dropdown :hide-on-click="false">
                    <div class="demo-basic--circle">
                        <div class="block">
                            <el-avatar :size="40" :src="avatar" :class="['avatar-info']">
                            </el-avatar>
                        </div>
                    </div>
                    <el-dropdown-menu slot="dropdown" style="margin-top:-30px;margin-left: -30px;">
<!--                        <el-dropdown-item><i class="el-icon-info"></i>个人中心</el-dropdown-item>-->
                        <el-dropdown-item @click.native="logoutUser"><i class="el-icon-switch-button"></i>退出登录</el-dropdown-item>
                    </el-dropdown-menu>
                </el-dropdown>
            </div>
<!--            <div>{{name}}</div>-->
        </el-header>
    </div>
</template>
<script>
    import {buss_logout} from "../../../api/api";
    import {removeToken} from "../../../utill/Token";

    export default {
        data() {
            return {
                avatar: 'https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png',
                name: ''
            }
        },
        created() {

        },
        methods:{
                logoutUser(){
                    buss_logout().then((res) => {
                        console.log(res.data)
                        if (res.data.status === 200) {
                            removeToken("bussiness_token")
                            this.$router.push({path: '/bussiness'});
                        }
                    });
            }
        }
    }
</script>
<style lang="scss" scoped>
    .header {
        .el-header {
            background: #2578b5;
            color: #fff;
            line-height: 60px;
            display: flex;
            justify-content: space-between;
            .title {
                width: 200px;
                font-size: 24px;
            }
        }
    }
    .avatar-info {
        margin-top: 10px;
        margin-right: 40px;
        cursor: pointer;
    }
</style>
